//
//  @ Project : Project1
//  @ File Name : Item.java
//  @ Date : 1/21/2013
//  @ Author : Graham Tapscott
//
//

/**
 * Item - the Item class is the base class that implements the IItem interface.  All other loot/treasure/artifacts
 * are inheirited from this base class.
 * @author gtapscott
 *
 */
public class Item implements IItem {
	
	protected Integer index;
	protected Integer creatureIndex = 0;
	protected String type = "";
	
	public Integer getIndex() {
		return index;
	}
	
	public Integer getCreatureIndex() {
		return creatureIndex;
	}
	
	public String getType() {
		return type;
	}
	
	public String toString() {
		return serialize();
	}
	
	public void deSerialize(String[] item) {
		this.index = Integer.parseInt(item[1].trim());
		this.type = item[2].trim();
		this.creatureIndex = Integer.parseInt(item[3].trim());		
	}
	
	public String serialize(){
		return "i:" + this.index + ":" + this.type + ":" + this.creatureIndex;		
	}

}
